package com.hgkj.cloud.base.service.impl;

import com.hgkj.cloud.base.common.PageInfo;
import com.hgkj.cloud.base.dao.SysTenantsMapper;
import com.hgkj.cloud.base.domain.SysTenants;
import com.hgkj.cloud.base.service.SysTenantsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class SysTenantsServiceImpl implements SysTenantsService {

    @Autowired
    private SysTenantsMapper sysTenantsMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        return sysTenantsMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(SysTenants record) {
        return sysTenantsMapper.insert(record);
    }

    @Override
    public int insertSelective(SysTenants record) {
        return sysTenantsMapper.insertSelective(record);
    }

    @Override
    public SysTenants selectByPrimaryKey(Long id) {
        return sysTenantsMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(SysTenants record) {
        return sysTenantsMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(SysTenants record) {
        return sysTenantsMapper.updateByPrimaryKey(record);
    }

    @Override
    public SysTenants getTenantByCode(String code) {
        return sysTenantsMapper.getTenantByCode(code);
    }

    @Override
    public SysTenants getTenantInfo(Map<String, Object> map) {
        return sysTenantsMapper.getTenantInfo(map);
    }

    @Override
    public List<SysTenants> listTenants(PageInfo pi, Map<String, Object> map) {
        if(pi != null){
            map.put("currentCount", pi.getCurrentCount());
            map.put("pageSize", pi.getPageSize());
        }
        return sysTenantsMapper.listTenants(map);
    }

    @Override
    public List<SysTenants> listAllTenants() {
        return sysTenantsMapper.listAllTenants();
    }

    @Override
    public List<SysTenants> listSearchTenants(Map<String, Object> map) {
        return sysTenantsMapper.listSearchTenants(map);
    }

    @Override
    public List<SysTenants> listSonTenants(Long father_id) {
        return sysTenantsMapper.listSonTenants(father_id);
    }

    @Override
    public Long listAllTenantsCount(Map<String, Object> map) {
        return sysTenantsMapper.listAllTenantsCount(map);
    }

    @Override
    public Long findAddTenantsCount(Map<String, Object> map) {
        return sysTenantsMapper.findAddTenantsCount(map);
    }

    @Override
    public List<SysTenants> listAllSystemTenants(PageInfo pi, Map<String, Object> map) {
        if(pi != null){
            map.put("currentCount", pi.getCurrentCount());
            map.put("pageSize", pi.getPageSize());
        }
        return sysTenantsMapper.listAllSystemTenants(map);
    }

    @Override
    public SysTenants findTopTenant() {
        return sysTenantsMapper.findTopTenant();
    }

    @Override
    public int disableTenant(Long id) {
        return sysTenantsMapper.disableTenant(id);
    }

    @Override
    public int enalbeTenant(SysTenants record) {
        return sysTenantsMapper.enalbeTenant(record);
    }

    @Override
    public List<SysTenants> backendGetListSonTenant(Long father_id) {
        return sysTenantsMapper.backendGetListSonTenant(father_id);
    }

    @Override
    public SysTenants getSimpleTenantById(Long id) {
        return sysTenantsMapper.getSimpleTenantById(id);
    }

    public SysTenants getTenantById(Long id) {
        return sysTenantsMapper.getTenantById(id);
    }

    @Override
    public SysTenants getTenantByIds(Long tenant_id) {
        return sysTenantsMapper.getTenantByIds(tenant_id);
    }

    @Override
    public List<SysTenants> getAllTenant() {
        return sysTenantsMapper.getAllTenant();
    }

    @Override
    public void deleteEnabledUser() {
        // TODO Auto-generated method stub
        sysTenantsMapper.deleteEnabledUser();
    }

    @Override
    public void deleteEnabledTenants() {
        // TODO Auto-generated method stub
        sysTenantsMapper.deleteEnabledTenants();
    }

    @Override
    public void deleteEnabledFramework() {
        // TODO Auto-generated method stub
        sysTenantsMapper.deleteEnabledFramework();
    }

    @Override
    public int updateTenantCreateDate(String string) {
        return sysTenantsMapper.updateTenantCreateDate(string);
    }

    @Override
    public int deleteTenantCreateDate() {
        return sysTenantsMapper.deleteTenantCreateDate();
    }

    @Override
    public List<SysTenants> listDataByMap(Map<String, Object> map) {
        return sysTenantsMapper.listDataByMap(map);
    }
}
